# n = int(input())
# s = input()
# # a表示栈
# a = []
# ok = True
# for c in s:
#     # 左括号入栈
#     if c == '(':
#         a.append(c)
#     # 有括号出栈
#     else:
#         # 如果栈为空，右括号多了
#         if len(a) == 0:
#             ok = False
#             break
#         a.pop()
#
# if ok and len(a) == 0:
#     print("Yes")
# else:
#     print("No")


# 颠三倒四
s = input()
s = s.replace('5', '')
s = s.replace('7', '')
s = s.replace('6', '9')
s = list(s)

a = []
for i, c in enumerate(s):
    if c == '3':  # 入栈
        a.append(i)  # 存入的是下标
    elif c == '4' and len(a) != 0:  # 出栈
        # 当遇到字符'4'时，从栈中取出最近一个'3'的位置
        # 并将这两个字符的位置互换
        idx = a.pop()
        s[i], s[idx] = s[idx], s[i]
print(' '.join(s))
